﻿using System.ComponentModel;
using System.Linq;

namespace TestSupport
{
	public class NotifiyPropertyChangedRecorder
	{
		private readonly EventRecorder eventRecorder;


		public NotifiyPropertyChangedRecorder(EventRecorder eventRecorder)
		{
			this.eventRecorder = eventRecorder;
		}


		public void Attach(INotifyPropertyChanged notifyPropertyChanged)
		{
			notifyPropertyChanged.PropertyChanged += NotifyPropertyChangedOnPropertyChanged;
		}


		private void NotifyPropertyChangedOnPropertyChanged(object sender, PropertyChangedEventArgs args)
		{
			this.eventRecorder.Record(sender, args);
		}
	}
}